package com.lovo.Atm;

import com.lovo.Util;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Save extends JPanel implements ActionListener {
    private JButton backImg;
    private JButton sureImg;
    private Home frame;

    private Icon sureBtn = Util.iconImg("/images/buttonSure.jpg");
    private Icon backBtn = Util.iconImg("/images/buttonOff.jpg");

    public Save(Home frame) {
        this.frame = frame;
        this.setLayout(null);
        this.setOpaque(false);

//        JLabel title = new JLabel("存款");
//        title.setBounds(100, 100, 100, 50);
//        this.add(title);


        //返回按钮，菜单界面
        backImg = new JButton(backBtn);
        backImg.setBounds(650, 300, 140, 50);
        this.add(backImg);
        backImg.addActionListener(this);

        //确认
        sureImg = new JButton(sureBtn);
        sureImg.setBounds(350, 300, 140, 50);
        this.add(sureImg);
        sureImg.addActionListener(this);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == backImg) {
            frame.switchPanel("menu");
        }
        if (e.getSource() == sureImg) {
            frame.switchPanel("save");
        }
    }
}
